﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sun.Mvc.IDAL;

namespace Sun.Mvc.DAL
{
    public class Article : IArticle
    {
        Sun_CmsEntities db = new Sun_CmsEntities();
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Insert(Models.Article model)
        {
            db.Article.Add(model);
            return db.SaveChanges();
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Update(Models.Article model)
        {
            db.Entry<Models.Article>(model).State = System.Data.Entity.EntityState.Modified;
            return db.SaveChanges();
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        public IQueryable<Models.Article> GetList()
        {
            return db.Article.AsQueryable();
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool Delete(int id)
        {
            return false;
        }
    }
}
